package quanquan.online.dao.impl;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import quanquan.online.bean.UserRewardBean;
import quanquan.online.dao.IUserRewardDao;


public class UserRewardDaoImpl extends HibernateDaoSupport implements IUserRewardDao {

	public void addUserReward(UserRewardBean userReward) {
		try {
			this.getHibernateTemplate().save(userReward);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public UserRewardBean getUserOnlineRewardInfo(int id) {
		UserRewardBean userReward = null;
		try {
			userReward = (UserRewardBean) this.getHibernateTemplate().get(UserRewardBean.class, id);
		} catch (DataAccessException e) {
			e.printStackTrace();
		}
		return userReward;
	}

	public UserRewardBean getReceiveTime(int id) {
		UserRewardBean userReward  = null;
		try {
			userReward = (UserRewardBean) this.getHibernateTemplate().get(UserRewardBean.class, id);
		} catch (DataAccessException e) {
			e.printStackTrace();
		}
		return userReward;
	}

	public void updateUserReward(UserRewardBean userReward) {
		try {
			this.getHibernateTemplate().update(userReward);
		} catch (DataAccessException e) {
			e.printStackTrace();
		}
	}

	
}
